// Copyright Rachael Colley 2013.

package net.playcabbage.model;

import java.util.ArrayList;
import java.util.List;

import net.playcabbage.xxx.*;



public class GridCellBean {

	private int gridcell_id;
	//private int cellcategory_id;
	private int location_id;
	private int x;
	private int y;
	private int z;
	private int lat;
	private int lon;
	private String cellcat;
	//private String cellcat;
	// gson ignores these fields.
	private transient Location location;
	private transient List<ICollectible> collectibles;

	public GridCellBean() {

	}

	public GridCellBean(int gridcell_id, int location_id,
			int x, int y, int z, int lat, int lon, String cellcat) {
		this.setGridcell_id(gridcell_id);
		this.setLocation_id(location_id);
		this.setX(x);
		this.setY(y);
		this.setZ(z);
		this.setLat(lat);
		this.setLon(lon);
		this.setCellcat(cellcat);
	}

	public GridCellBean (String cellCategory, Location location) {
		//setCellCategory(cellCategory);
		setLocation(location);
		collectibles = new ArrayList<ICollectible>();
	}

	public GridCellBean (String cellCategory, int z, int y, int x) {
		//setCellCategory(cellCategory);
		Location l = new Location(x,y,z);
		setLocation(l);
		collectibles = new ArrayList<ICollectible>();
	}

	//	public boolean equals(Object aThat){
	//		if ( this == aThat ) return true; // Compares the memory location - does 'this' have the same memory location as 'that'?.
	//		if ( !(aThat instanceof Location) ) return false; // Checks the type of object - instanceof compares an object to a specified type
	//		GridCellBean that = (GridCellBean)aThat; // Cast to InventoryItem type so that we can call it's methods
	//		return // Returns true or false based on each of the conditions.
	//				this.getCellCategory() == that.getCellCategory() &&
	//				this.getLocation() == that.getLocation();
	//	}
	//
	//	public String toString() {
	//		return "GridCell - cellCategory: " + this.getCellCategory() 
	//				+ " location: " + this.getLocation().toString();
	//	}

	public Location getLocation() {
		return location;
	}


	public void setLocation(Location location) {
		this.location = location;
	}

	public List<ICollectible> getCollectibles() {
		return collectibles;
	}

	public void setCollectibles(List<ICollectible> collectibles) {
		this.collectibles = collectibles;
	}

	public void addCollectible(ICollectible collectible) {
		this.collectibles.add(collectible);
	}

	public void removeCollectible(ICollectible collectible) {
		this.collectibles.remove(collectible);
	}
	public void removeAllCollectibles() {
		this.collectibles.clear();
	}

	public int getGridcell_id() {
		return gridcell_id;
	}

	public void setGridcell_id(int gridcell_id) {
		this.gridcell_id = gridcell_id;
	}

	public int getLocation_id() {
		return location_id;
	}

	public void setLocation_id(int location_id) {
		this.location_id = location_id;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public int getZ() {
		return z;
	}

	public void setZ(int z) {
		this.z = z;
	}

	public int getLat() {
		return lat;
	}

	public void setLat(int lat) {
		this.lat = lat;
	}

	public int getLon() {
		return lon;
	}

	public void setLon(int lon) {
		this.lon = lon;
	}

	public String getCellcat() {
		return cellcat;
	}

	public void setCellcat(String cellcat) {
		this.cellcat = cellcat;
	}



}
